// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'
import './assets/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import store from './store/index';
import globalfunc from "./plugins/globalfunc";
Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.prototype.$http=axios
Vue.prototype.$global=globalfunc
Vue.filter('PlayCount',(value)=> {
  if (value.toString().length>6){
    return value.toString().slice(0,2)+'万'
  }else {
    return value
  }
})
Vue.filter('setWH',(url , arg)=>{
  if(!url){return url}
  return url.replace(/w.h/,arg);
});
Vue.filter('dateFormat',function(originVal){
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth()+1+'').padStart(2,'0')//得两位数字，不足以0来填空
  const d = (dt.getDate()+'').padStart(2,'0')
  const hh = (dt.getHours()+'').padStart(2,'0')
  const mm = (dt.getMinutes()+'').padStart(2,'0')

  return `${y}-${m}-${d} ${hh}:${mm}`
});
/* eslint-disable no-new */
axios.interceptors.request.use(config=>{
  config.headers.Authorization=window.sessionStorage.getItem('token')
  return config
})
new Vue({
  store,
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
